import { getRdsUrl, rdsRequest } from '@/hooks/rdsServices';
import service from '../common/service';

const getDcStoreInfo = async () => {
    const rdsUrl = getRdsUrl()

    let dcStoreInfo = service.getLocalStorage('rdsDcStore') || [];
    if (dcStoreInfo.length == 0) {
        const res = await rdsRequest(rdsUrl.bcApi, 'Rds公共服务', 'GetAllDcStoreInfo');
        res.map(item => (
            dcStoreInfo.push({
                value: item.c_id,
                text: `[${item.c_id}]${item.c_sname}`
            })
        ));
        service.addlocalStorage('rdsDcStore', dcStoreInfo);
    }
    return dcStoreInfo;
}


export {
    getDcStoreInfo
}
